/*
Jack Morris
11/20/14
Chapter 6
Page 122
Assinment 3
*/
#include <stdbool.h>
#include <stdio.h>
 
int gcd(int n, int m)
{
	int gcd, remainder;
	while (n != 0)
	{
		remainder = m % n;
		m = n;
		n = remainder;
	}
	gcd = m;
	return gcd;
}
int main (int argc, const char * argv[]) {
	int number1, number2;
	int newNumber1, newNumber2;
	printf("Enter a fraction: ");
	scanf("%d/%d", &number1, &number2);
	newNumber1 = number1 / gcd(number1, number2);
	newNumber2 = number2 / gcd(number1, number2);
	printf("In lowest terms: %d/%d", newNumber1, newNumber2);
}